import { ArgumentMetadata, HttpException, HttpStatus, Injectable, PipeTransform } from "@nestjs/common";
@Injectable()
export class validateMobilePipe implements PipeTransform<string,string>{
    transform(value: string|number, metadata: ArgumentMetadata): any {
        
        
        const mobile=typeof value==='number'?String(value):value;
        if(mobile.length!==11){
            throw new HttpException('非法手机号',HttpStatus.BAD_REQUEST);
        }
        return mobile;
        
    }
}